<?php
/**
 * <https://y.st./>
 * Copyright © 2017 Alex Yst <mailto:copyright@y.st>
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <https://www.gnu.org./licenses/>.
**/

$xhtml = array(
	'<{title}>' => '<code>Unit7.java</code>',
	'<{subtitle}>' => 'Written in <span title="Programming 1">CS 1102</span> of <a href="http://www.uopeople.edu/">University of the People</a>, finalised on 2017-05-24',
	'<{copyright year}>' => '2017',
	'takedown' => '2017-11-01',
	'<{body}>' => <<<END
<blockquote>
<pre><code>/*
 * Copyright (C) 2017 Alex Yst
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see &lt;http://www.gnu.org/licenses/&gt;.
 */
package unit7;

/**
 * Alex Yst&apos;s CS 1102 (Programming 1) Unit 7 submission
 * 
 * This class was programmed to fill the requirements on the Unit 7 programming
 * assignment in University of the People&apos;s CS 1102 (Programming 1) course.
 * 
 * @author Alex Yst
 */
public class Unit7 {
/**
 * This method takes a hard-coded matrix, performs some checks on it, and
 * computes the value of the matrix. Were the matrix not hard-coded, it would
 * work on any matrix, as the rest of the code is flexible.
 * 
 * @param arguments Not implemented
 */
	public static void main(String[] arguments) {
		int[][] m = {
			{10, 12, 11},
			{ 9,  8, 31},
			{ 2, 16, 24},
		};
		int numberOfRows = m.length;
		int numberOfColumns = 0;
		if(numberOfRows != 0) {
			for(int[] row: m) {
				numberOfColumns = row.length;
				if(numberOfColumns != numberOfRows) {
					System.out.println(&quot;This is not a square matrix.&quot;);
					return;
				}
			}
		}
		int total = 0;
		for(int i = 0;i &lt; numberOfColumns; i++) {
			total += m[i][numberOfColumns-1-i];
		}
		System.out.println(&quot;Value of secondary diagonal: &quot; + total);
	}
}</code></pre>
</blockquote>
END
);
